﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BrokerBase.Lib.Policy;

namespace broker.duty.TK
{
    class Class3
    {
        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.SchemePeriodActing.InsurantStates.Contains("身故"))
            {
                if (ppa.IsAtPaymentPeriod)
                {
                    da.Value = ppa.Amount * ppa.Period + 1;
                }
                else
                {
                    da.Value = ppa.Amount * ppa.PolicyActing.Policy.PaymentPeriodLength;
                }
                ppa.IsCurrentFinish = true;
            }
        }

        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.Period==ppa.PolicyActing.PeriodActings.Count()-1)
            {
                if (ppa.IsAtPaymentPeriod)
                {
                    da.Value = ppa.Amount * ppa.Period + 1;
                }
                else
                {
                    da.Value = ppa.Amount * ppa.PolicyActing.Policy.PaymentPeriodLength;
                }
                ppa.IsCurrentFinish = true;
            }
        }
    }
}
